using System.Collections.Generic;

namespace CloudStorage.API.Messages
{
  /// <summary>
  /// Data Context for manipulating a Cloud Storage Messages
  /// </summary>
  public interface IMessageDataContext
  {
    /// <summary>
    /// Puts a message in the queue.
    /// </summary>
    /// <param name="message">The message to store in the queue.</param>
    void PutMessage(string message);

    /// <summary>
    /// Puts a message in the queue.
    /// </summary>
    /// <param name="message">The message to store in the queue.</param>
    /// <param name="timeToLiveInSeconds">The time to live for the message in seconds.</param>
    void PutMessage(string message, int timeToLiveInSeconds);
  
    /// <summary>
    /// Tries to retrieve the given number of messages.
    /// </summary>
    /// <param name="numberOfMessages">Maximum number of messages to retrieve.</param>
    /// <returns>The list of messages retrieved.</returns>        
    IEnumerable<IMessage> GetMessages(int numberOfMessages);

    /// <summary>
    /// Tries to retrieve the given number of messages.
    /// </summary>
    /// <param name="numberOfMessages">Maximum number of messages to retrieve.</param>
    /// <param name="visibilityTimeoutInSeconds">The visibility timeout of the retrieved messages in seconds.</param>
    /// <returns>The list of messages retrieved.</returns>        
    IEnumerable<IMessage> GetMessages(int numberOfMessages, int visibilityTimeoutInSeconds);

    /// <summary>
    /// Tries to get a copy of messages in the queue without actually dequeuing the messages.
    /// The messages will remain visible in the queue.
    /// </summary>
    /// <param name="numberOfMessages">Maximum number of message to retrieve.</param>
    /// <returns>The list of messages retrieved.</returns>        
    IEnumerable<IMessageInfo> PeekMessages(int numberOfMessages);

    /// <summary>
    /// Deletes a message from the queue.
    /// </summary>
    /// <param name="messageId"></param>
    /// <param name="popReceipt"></param>
    void DeleteMessage(string messageId, string popReceipt);

    /// <summary>
    /// Delete all messages in a queue.
    /// </summary>
    void Clear();
  }
}